new
	AD_FileDataKeys[4][17]=
	{
		"AD_DefendingTeam",
		"AD_CapturePoint1",
		"AD_CapturePoint2",
		"AD_CapturePoint3"
	},
	PointToCapture,		 				// Sphere to detect player presence
	MaxPoints,                      	// Maximum points to capture for large maps with multiple capture points
	CaptureProgress,                	// For extra spawn points for large A/D maps
	Float:CapturePoint[3][3],	  		// Capture Point Position
	CaptureIcon,						// Icon for capture point position
	bool:PointCT,						// Timer variable
	capturer,                       	// Person who is capturing
	DefendingTeam,	 					// Defending Team
	Bar:ADbar,                      	// Progress Bar
	ADfill,                         	// Fill amount for Bar
	ADcaptureTime=30;					// Capture Time In Seconds


GetPlayersCapturingAD()
{
	new c;
	PlayerLoop(i)if(bPlayerDeathmatchSettings[i]&CapturingADPoint)c++;
	return c;
}


AD_CaptureUpdate(playerid)
{
	ADfill += (1*GetPlayersCapturingAD());
	SetProgressBarValue(ADbar, ADfill);
	PlayerLoop(i)if(bPlayerGameSettings[i]&InDM&&(bPlayerDeathmatchSettings[i]&CapturingADPoint))UpdateProgressBar(ADbar, i);
	if(ADfill==ADcaptureTime)
	{
		GiveXP(playerid, 25, "Capture");
	    PlayerLoop(i)
		{
			if(IsPlayerInDynamicArea(i, PointToCapture)&&i!=playerid)GiveXP(i, 15, "Capture Assist");
			if(bPlayerGameSettings[i]&InDM)HideProgressBarForPlayer(i, ADbar);
		}
		ADfill=0;
		DestroyDynamicArea(PointToCapture);
		PointCT=false;

		CaptureProgress++;
		if(CaptureProgress>=MaxPoints)
		{
			StopMatchTime();
			WinningTeam = !DefendingTeam;
			EndRound();
		}
		else
		{
			PointToCapture=CreateDynamicSphere(CapturePoint[CaptureProgress][0], CapturePoint[CaptureProgress][1], CapturePoint[CaptureProgress][2], 5.0, DEATHMATCH_WORLD);
			Streamer_SetFloatData(STREAMER_TYPE_MAP_ICON, CaptureIcon, E_STREAMER_X, CapturePoint[CaptureProgress][0]);
			Streamer_SetFloatData(STREAMER_TYPE_MAP_ICON, CaptureIcon, E_STREAMER_Y, CapturePoint[CaptureProgress][1]);
			Streamer_SetFloatData(STREAMER_TYPE_MAP_ICON, CaptureIcon, E_STREAMER_Z, CapturePoint[CaptureProgress][2]);
	    }
	}
}

